<?php include './application/views/common/shop_head.php'; ?>
<div class="mall_xinxi">
  <div class="xinxi_con">
    <h3 style="line-height:60px;padding-left:10px; border-bottom:1px solid #dcdcdc;">填写并核对兑换信息</h3>
	<form id="car_form">
		<h3 style="margin-top:30px; margin-left:25px; padding-left:5px; margin-bottom:10px; ">收货人信息</h3>
			<?php if ($last_order){?>
			<ul style="margin-top:40px; margin-botom:20px;margin-left:20px; border-bottom:1px dashed #dcdcdc;">
				<li style="height:40px; margin-left:15px;"><input id="radio" type="radio" checked="checked" value="1" name="last_address" onclick="show_address_type(1)"> <?php echo $last_order['get_name'];?>  <?php echo $last_order['get_address'];?>   <?php echo $last_order['get_phone'];?>   </li>
				<li style="height:36px; margin-left:15px;"><input id="radio"  type="radio" value="0" name="last_address" onclick="show_address_type(0)"> 使用新地址</li>
			</ul>
			<?php }?>
				<ul id="new_address" style="margin-top:40px; margin-botom:20px;margin-left:20px; border-bottom:1px dashed #dcdcdc; <?php if ($last_order){?>display:none;<?php }?>">
					<li style="height:40px; margin-left:15px;">
					  <label for="name">收 &nbsp;货&nbsp; 人<span style="color:#ff590a"> *&nbsp; </span></label>
					  <input type="text" name="get_name">
					</li >
					<li style="height:36px; margin-left:15px;">
					  <label for="email">收货地址<span style="color:#ff590a"> &nbsp;*&nbsp; </span> </label>
					  <input type="text" name="get_address">
					</li>
					<li style="height:36px; margin-left:15px;">
					  <label for="company">手机号码<span style="color:#ff590a">  &nbsp;*&nbsp; </span> </label>
					  <input type="text" name="get_phone">
					  （兑换充卡值的客户，此处填写充值号码，若有多个充值号码请分开兑换）
					</li>
					<li style="height:36px; margin-left:15px;">
					  <label for="subject">邮 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;编&nbsp;<span style="color:#ff590a"> &nbsp;*&nbsp; </span> </label>
					  <input type="text" name="get_pc">
					</li>
			  </ul>
			 
				<input type="hidden" name="pid" value="<?php echo $info['id'];?>">
				<input type="hidden" name="pnum" value="<?php echo $num;?>">
	</form>
        
    <h4 style="margin-top:30px; margin-left:78px; padding-left:5px; margin-bottom:10px; ">兑换商品信息：</h4> 
    <table style="width:836px;margin-top:20px;margin-left:auto;margin-right:auto;font-size:14px;">
		<tr>
	        <th style="border-left:1px solid #2a84c3;">商品名称</th>
            <th>普通会员积分价</th>
            <th>VIP会员积分价</th>
            <th>数量</th>
            <th style="border-right:1px solid #2a84c3;">库存数量</th>
		</tr>
        <tr >
			<td><?php echo $info['pname'];?> </td>
			<td><?php echo $info['pcredit'];?></td>
			<td><?php echo $info['pvipcredit'];?></td>
			<td>x <?php echo $num;?></td>
			<td><?php echo $info['psurp']>=$num ? '有货':'缺货';?></td>
		</tr>
    </table>  
          
          <p style="dispaly:block; margin-top:40px; margin-left:80px;">
          当前剩余积分：<span style="color:#ff590a"><?php echo $credit['available'];?></span>分   
          兑换需要积分：<span style="color:#ff590a"><?php echo $info['pcredit']*$num;?></span>分
          VIP只需积分：<span style="color:#ff590a"><?php echo $info['pvipcredit']*$num;?></span>分
          <span style="float:right; margin-right:83px; position:relative; top:-20px;"><a href="javascript:void(0);" class="gsdshop_orange" onclick="tosub();"><img src="/static/images/bt-pd-duihuan.png" width="126" height="40" /></a></span>
          </p>
  </div>
  
  
</div>

<div id="dialog" style="display:none">
<p id="msg" style="text-align:center;clear: both;"></p>
</div>
<script>


function tosub(){
	var options = {
		url : '/shop/buy.html',
		dataType: "json",
		type:"post",
		success : function(ret) {
			$("#msg").html(ret.msg);
			$('#dialog').dialog({
				modal:true,
				title:'系统提示',
				buttons:{"确定":function(){$(this).dialog("close");}},
				close: function() {
					if(ret.url!=''){
						location=ret.url;
					}
				}
			});
			
		}
	};
	$("#car_form").ajaxSubmit(options);
	return false;
}

function show_address_type(id){
	if(id == 1){
		$("#new_address").hide();
	}else{
		$("#new_address").show();
	}	
}
</script>
<!-- GsdShopList End -->
<?php include './application/views/common/footer.php'; ?>


